<?php
$collection = isset($collection) ? $collection :false;
if ($collection) {
  $group = $collection->groups;
  if (!$group) $group = array();
}
?>  
<?php foreach ($group as $g):?>
    <div class='tags' style='padding-top:10px;height:50px;width:250px;margin-left:15px;'>
      <span style='margin-left:10px;' class='label label-info'><?php echo $g->name;?></span>
      <ul> 
      <?php $tags = explode(',', $g->tags); foreach ($tags as $t):?>
        <li><a class='label' href='/gallery/?cid=<?php echo $collection->id?>&tag=<?php echo $t;?>'><?php echo $t;?></a></li>
      <?php endforeach;?>
      <ul>
    </div>
    <div style='height:5px;clear:both;'></div>
<?php endforeach;?>
